#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <string>
using namespace std;
//hihi
vector<string> commonChars(vector<string>& A)
{
    vector<int> res(26,INT_MAX);
    vector <string> ress;
    for(int i=0;i<A.size();++i){
        vector<int> temp(26,0);
        for(int j=0;j<A[i].size();++j){
            ++temp[A[i][j]-'a'];
        }
        for(int i=0;i!=26;++i){
            res[i]=min(res[i],temp[i]);
        }
    }
    for(int i=0;i!=26;++i){
        for(int j=0;j<res[i];++j){
            string temps;
            temps.push_back('a'+i);
            ress.push_back(temps);
        }
    }
    return ress;
}

int main(int argc, char const *argv[])
{
    vector<string> a={"bella","label","roller"};
    vector<string> k=commonChars(a);
    for(int i=0;i!=k.size();++i){
        for(int j=0;j!=k[i].size();++j){
            cout<<k[i][j]<<" ";
        }
        cout<<endl;
    }
    return 0;
}

